package com.example.demo.pojos;

import javax.persistence.*;
import java.sql.Date;
import java.util.List;
import java.util.Objects;

@Entity
public class User {
    private int uid;
    private String uName;
    private String uPass;
    private Date uRegTime;
    private String uAvater;
    private String uPhone;
    private String uEmial;
    private String uSex;
    private Byte uLocked;
    private List<Xsjhinfo> xsjh1;
    private List<Xsjhinfo> xsjh;
    private List<Bjmxinfo> bjmx;
    private List<Order> htdd;
    private List<Show> gh;
    private List<Serve> fw;
    private List<Complain> ts;
    private List<Fixreceive> wxjj;
    private List<Fixcheck> wxjc;
    private List<Fix> wx;
    private List<Operation> czrz;
    private List<Role> js;

    @Id
    @Column(name = "uid", nullable = false)
    public int getUid() {
        return uid;
    }

    public void setUid(int uid) {
        this.uid = uid;
    }

    @Basic
    @Column(name = "uName", nullable = true, length = 20)
    public String getuName() {
        return uName;
    }

    public void setuName(String uName) {
        this.uName = uName;
    }

    @Basic
    @Column(name = "uPass", nullable = true, length = 20)
    public String getuPass() {
        return uPass;
    }

    public void setuPass(String uPass) {
        this.uPass = uPass;
    }

    @Basic
    @Column(name = "uRegTime", nullable = true)
    public Date getuRegTime() {
        return uRegTime;
    }

    public void setuRegTime(Date uRegTime) {
        this.uRegTime = uRegTime;
    }

    @Basic
    @Column(name = "uAvater", nullable = true, length = 150)
    public String getuAvater() {
        return uAvater;
    }

    public void setuAvater(String uAvater) {
        this.uAvater = uAvater;
    }

    @Basic
    @Column(name = "uPhone", nullable = true, length = 20)
    public String getuPhone() {
        return uPhone;
    }

    public void setuPhone(String uPhone) {
        this.uPhone = uPhone;
    }

    @Basic
    @Column(name = "uEmial", nullable = true, length = 50)
    public String getuEmial() {
        return uEmial;
    }

    public void setuEmial(String uEmial) {
        this.uEmial = uEmial;
    }

    @Basic
    @Column(name = "uSex", nullable = true, length = 4)
    public String getuSex() {
        return uSex;
    }

    public void setuSex(String uSex) {
        this.uSex = uSex;
    }

    @Basic
    @Column(name = "uLocked", nullable = true)
    public Byte getuLocked() {
        return uLocked;
    }

    public void setuLocked(Byte uLocked) {
        this.uLocked = uLocked;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        User user = (User) o;
        return uid == user.uid &&
                Objects.equals(uName, user.uName) &&
                Objects.equals(uPass, user.uPass) &&
                Objects.equals(uRegTime, user.uRegTime) &&
                Objects.equals(uAvater, user.uAvater) &&
                Objects.equals(uPhone, user.uPhone) &&
                Objects.equals(uEmial, user.uEmial) &&
                Objects.equals(uSex, user.uSex) &&
                Objects.equals(uLocked, user.uLocked);
    }

    @Override
    public int hashCode() {
        return Objects.hash(uid, uName, uPass, uRegTime, uAvater, uPhone, uEmial, uSex, uLocked);
    }

    @OneToMany(mappedBy = "fzr")
    public List<Xsjhinfo> getXsjh1() {
        return xsjh1;
    }

    public void setXsjh1(List<Xsjhinfo> xsjh1) {
        this.xsjh1 = xsjh1;
    }

    @OneToMany(mappedBy = "tgr")
    public List<Xsjhinfo> getXsjh() {
        return xsjh;
    }

    public void setXsjh(List<Xsjhinfo> xsjh) {
        this.xsjh = xsjh;
    }

    @OneToMany(mappedBy = "syr")
    public List<Bjmxinfo> getBjmx() {
        return bjmx;
    }

    public void setBjmx(List<Bjmxinfo> bjmx) {
        this.bjmx = bjmx;
    }

    @OneToMany(mappedBy = "qyr")
    public List<Order> getHtdd() {
        return htdd;
    }

    public void setHtdd(List<Order> htdd) {
        this.htdd = htdd;
    }

    @OneToMany(mappedBy = "zxr")
    public List<Show> getGh() {
        return gh;
    }

    public void setGh(List<Show> gh) {
        this.gh = gh;
    }

    @OneToMany(mappedBy = "zxr")
    public List<Serve> getFw() {
        return fw;
    }

    public void setFw(List<Serve> fw) {
        this.fw = fw;
    }

    @OneToMany(mappedBy = "zxr")
    public List<Complain> getTs() {
        return ts;
    }

    public void setTs(List<Complain> ts) {
        this.ts = ts;
    }

    @OneToMany(mappedBy = "jdr")
    public List<Fixreceive> getWxjj() {
        return wxjj;
    }

    public void setWxjj(List<Fixreceive> wxjj) {
        this.wxjj = wxjj;
    }

    @OneToMany(mappedBy = "jcr")
    public List<Fixcheck> getWxjc() {
        return wxjc;
    }

    public void setWxjc(List<Fixcheck> wxjc) {
        this.wxjc = wxjc;
    }

    @OneToMany(mappedBy = "wxr")
    public List<Fix> getWx() {
        return wx;
    }

    public void setWx(List<Fix> wx) {
        this.wx = wx;
    }

    @OneToMany(mappedBy = "yh")
    public List<Operation> getCzrz() {
        return czrz;
    }

    public void setCzrz(List<Operation> czrz) {
        this.czrz = czrz;
    }

    @ManyToMany
    @JoinTable(name = "userrole", catalog = "", schema = "byxm", joinColumns = @JoinColumn(name = "uid", referencedColumnName = "uid", nullable = false), inverseJoinColumns = @JoinColumn(name = "rid", referencedColumnName = "rid", nullable = false))
    public List<Role> getJs() {
        return js;
    }

    public void setJs(List<Role> js) {
        this.js = js;
    }
}
